package com.elitesland.core.exception;

import com.elitesland.core.base.ApiCode;
import lombok.Getter;

import java.util.function.Supplier;

/**
 * <pre>
 * 业务异常
 * </pre>
 *
 * @author Mir
 * @date 2020/6/22
 */
@Getter
public class BusinessException extends RuntimeException implements Supplier<BusinessException> {

    private static final long serialVersionUID = -2205002357611194846L;

    private ApiCode code;

    public BusinessException() {
        super();
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(ApiCode code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    @Override
    public BusinessException get() {
        return this;
    }
}
